-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree Borrows: Make tree root always be initialized #3415
Tree Borrows: Make tree root always be initialized #3415
Conversation
00adb65
to
8a6587e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to Miri. :)
I have some questions about the PR, though.
After some further thought, we decided to make the root note default |
8ab3543
to
63107f8
Compare
// we manually set it to `Active` on all in-bounds positions. | ||
// we also ensure that it is initalized, so that no `Active` but | ||
// not yet initialized nodes exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// we manually set it to `Active` on all in-bounds positions. | |
// we also ensure that it is initalized, so that no `Active` but | |
// not yet initialized nodes exist. | |
// We manually set it to `Active` on all in-bounds positions. | |
// We also ensure that it is initalized, so that no `Active` but | |
// not yet initialized nodes exist. Essentially, we pretend there | |
// was a write that initialized these to `Active`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You dropped part of my diff, I had also fixed capitalization in the first two lines.
That's why using the github button is a good idea. ;) (You can than still pull, squash, force-push if you want to avoid the extra commit.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, alternatively I could simply look more closely 🙈
I've also fixed capitalization in other places.
LGTM, just one comment nit. :) |
63107f8
to
07bbebb
Compare
There should never be an `Active` but not initialized node in the borrow tree. If such a node exists, and if it has a protector, then on a foreign read, it could become disabled. This leads to some problems when formally proving that read-reordering optimizations are sound. The root node is the only node for which this can happen, since all other nodes can only become `Active` when actually used. But special- casing the root node here is annoying to reason about, everything becomes much nicer if we can simply say that *all* `Active` nodes must be initialized. This requires making the root node default- initialized. This is also more intuitive, since the root arguably becomes ini- tialized during the allocation, which can be considered a write.
07bbebb
to
5b208c4
Compare
Thanks! |
☀️ Test successful - checks-actions |
This PR fixes a slight annoyance we discovered while formally proving that certain optimizations are sound with Tree Borrows. In particular... (copied from the commit message):
There should never be an
Active
but not initialized node in the borrow tree. If such a node exists, and if it has a protector, then on a foreign read, it could become disabled. This leads to some problems when formally proving that read moving optimizations are sound.The root node is the only node for which this can happen, since all other nodes can only become
Active
when actually used. But special-casing the root node here is annoying to reason about, everything becomes much nicer if we can simply say that allActive
nodes must be initialized. This requires making the root node default-initialized.This is also more intuitive, since the root arguably becomes initialized during the allocation, which can be considered a write.